﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/SiteContent.Master" AutoEventWireup="true"
    CodeBehind="Initialization.aspx.cs" Inherits="Warehouse.Web.Inventory.Initialization" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .modulecontent li h2 {
            background: #ccf;
            padding-left: 10px;
        }
        .datatable {
            width: 100%;
        }
        .col_category {
            background: #ccf;
            text-align: center;
        }
        .col_category input {
            float: right;
            margin: 0 5px;
        }
        .col_category .categoryname {
            font-weight: bold;
        }
        .col_product_sn {
            width: 40px;
        }
        .col_product_name {
        }
        .col_spec_spec {
            width: 50px;
            text-align: center;
        }
        .col_spec_parkingspec {
            width: 50px;
            text-align: center;
        }
        .col_spec_unit {
            width: 30px;
            text-align: center;
        }
        .col_inventory {
            width: 60px;
        }
        .col_inventory input {
            width: 100%;
            height: 22px;
        }
    </style>

    <script type="text/javascript">
        function check() {
            var err = null;
            var elem = null;
            $(' .col_inventory input[type="text"]').each(function() {
                if (!err && isNaN($(this).val())) {
                    err = "请输入数字";
                    elem = $(this);
                }
            });
            if (err) {
                alert(err);
                elem.focus().select();
                return false;
            }
            return confirm("确认保存？");
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="moduleheader">
        <h4>
            初始化库存</h4>
        <div class="moduleheadertoolbar">
            <label>
                仓库:
                <asp:DropDownList ID="ddlWarehouse" runat="server" DataTextField="Name" DataValueField="ID">
                </asp:DropDownList>
            </label>
            <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_OnClick" Text="查看" CssClass="ui-button" />
            <uc:AuthorityControl runat="server" Action="Save">
                <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="保存" Visible="false"
                    OnClientClick="return check();" CssClass="ui-button" />
            </uc:AuthorityControl>
        </div>
    </div>
    <div class="modulecontent">
        <table id="tablecategories" class="datatable">
            <tr>
                <th class="col_product_sn">
                    编号
                </th>
                <th class="col_product_name">
                    产品
                </th>
                <th class="col_spec_spec">
                    规格
                </th>
                <th class="col_spec_parkingspec">
                    包装规格
                </th>
                <th class="col_spec_unit">
                    单位
                </th>
                <th class="col_inventory">
                    库存
                </th>
            </tr>
            <asp:Repeater ID="rptCategories" runat="server" OnItemDataBound="rptCategories_ItemDataBound">
                <ItemTemplate>
                    <tr>
                        <td class="col_category" colspan="6">
                            <span class="categoryname" categoryid="<%# Eval("ID") %>">
                                <%#Eval("Name")%></span>
                        </td>
                    </tr>
                    <asp:Repeater ID="rptProducts" runat="server">
                        <ItemTemplate>
                            <tr>
                                <asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible='<%# Eval("FirstProduct") %>'>
                                    <td class="col_product_sn" rowspan='<%#Eval("ProductSpecificatoinCount")%>'>
                                        <%#Eval("Product.SerialNumber")%>
                                    </td>
                                </asp:PlaceHolder>
                                <asp:PlaceHolder ID="PlaceHolder2" runat="server" Visible='<%# Eval("FirstSpecification") %>'>
                                    <td class="col_product_name" rowspan='<%#Eval("SpecificatoinCount") %>'>
                                        <%#Eval("Product.Name")%>&nbsp;&nbsp;&nbsp;&nbsp;<%#Eval("Product.Grade")%>&nbsp;&nbsp;&nbsp;&nbsp;<%#Eval("Product.Model")%><br />
                                        <%#Eval("Product.Description")%>
                                    </td>
                                </asp:PlaceHolder>
                                <td class="col_spec_spec">
                                    <%# Eval("Product.Specification")%>
                                </td>
                                <td class="col_spec_parkingspec">
                                    <%# Eval("Product.PackagingSpecification")%>
                                </td>
                                <td class="col_spec_unit">
                                    <%# Eval("Product.Unit")%>
                                </td>
                                <td class="col_inventory">
                                    <input type="text" name="Inventory_<%#Eval("Product.ID")%>" value=" <%# Eval("Inventory") %>" />
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </ItemTemplate>
            </asp:Repeater>
        </table>
    </div>
</asp:Content>
